package com.me.testcustomview;

import java.util.ArrayList;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;

import com.actionbarsherlock.R;
import com.actionbarsherlock.internal.ResourcesCompat;
import com.actionbarsherlock.internal.widget.IcsAbsSpinner;
import com.actionbarsherlock.internal.widget.IcsSpinner;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;

public class AbExamTitle extends LinearLayout {
	public String title;
	private ArrayList<String> index;
	private TextView tvTitle;
	//private Spinner icsSpIndex;
	private IcsSpinner icsSpIndex;

	
	public AbExamTitle(Context context, String title, ArrayList<String> index) {
		super(context);
		this.title = title;
		this.index = index;
		
		
		this.setOrientation(VERTICAL);
		
		tvTitle = new TextView(context);
		//tvTitle.setTextAppearance(context, R.style.TextAppearance_Sherlock_Widget_ActionBar_Title);
		
		tvTitle.setText(title);
		tvTitle.setTextColor(Color.parseColor("#33CCFF"));
		tvTitle.setSingleLine(true);
		addView(tvTitle, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		
		XmlPullParser parser = context.getResources().getXml(com.me.testcustomview.R.xml.ics_spinner_attrs);
		AttributeSet attrs = Xml.asAttributeSet(parser); 
		icsSpIndex = new IcsSpinner(context, attrs);
		MyAdapter adapter = new MyAdapter(context, 0, 1, "", index);
		icsSpIndex.setAdapter(adapter);
		addView(icsSpIndex, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

		
		
	}

	public AbExamTitle(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}

	@SuppressLint("NewApi")
	public AbExamTitle(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		// TODO Auto-generated constructor stub
	}

}
